﻿using System;
using EmbeddedSharp.Core;

namespace EmbeddedSharp.Scripting.Function {
    public class DeclareNode : OperatorNode {

        private string name = string.Empty;

        private int numberOfParameters = 0;

        public string Name {
            get {
                return this.name;
            }
        }

        public int NumberOfParameters {
            get {
                return this.numberOfParameters;
            }
        }

        public override object Evaluate() {
            foreach (Node child in Parameters) {
                child.Evaluate();
            }

            UserDefinedFunctionNode func
                = Parameters[0] as UserDefinedFunctionNode;
            FuncNode funcBody = Parameters[1] as FuncNode;
            func.Body = funcBody;

            return string.Empty;
        }
    }
}
